package com.zhanhong.opencvdemo.dialog;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import com.zhanhong.opencvdemo.R;


public class SimpleProgressDialog extends CustomBaseDialog {

    private Context mContext;
    private TextView mTvContent;

    public SimpleProgressDialog(Context context) {
        super(context);
        mContext = context;
    }

    @Override
    public void initWindow(WindowManager windowManager, Window window) {
        window.setGravity(Gravity.CENTER);
        initView();
    }

    private void initView() {
        mTvContent = findViewById(R.id.tv_content);
    }

    @Override
    public boolean setDialogCancelable() {
        return false;
    }

    @Override
    public View setDialogView() {
        return LayoutInflater.from(mContext).inflate(R.layout.dialog_simple_progress, null);
    }

    public void setContent(String content) {
        if (mTvContent != null && isShowing()) {
            mTvContent.setText("正在执行：" + content + "，请稍后");
        }
    }
}
